from api.base_api import BaseApi


class Member(BaseApi):
    def add(self,userid,name,department,mobile,email,**kwargs):
        data = {
            "userid":userid,
            "name":name,
            "department":department,
            "mobile":mobile,
            "email":email
        }
        data.update(kwargs)
        r = self.send('POST',f'user/create?access_token={self.token}',json=data)
        return r

    def get(self,userid):
        r = self.send('GET',f'user/get?access_token={self.token}&userid={userid}')
        return r

    def update(self,userid,**kwargs):
        data = {
            "userid":userid
        }
        data.update(kwargs)
        r = self.send('POST', f'user/update?access_token={self.token}',json=data)
        return r

    def delete(self,userid):
        r = self.send('GET', f'user/delete?access_token={self.token}&userid={userid}')
        return r